package com.esunny.db.hbase;

public class ActionFactory {

    public static Action getAction(String name, String tableName, int keySpace, int valueSize, int fieldSize) {
        Action action = null;
        if ("read".equalsIgnoreCase(name)) {
            action = new ReadAction();
        }
        if ("insert".equalsIgnoreCase(name)) {
            action = new InsertAction();
        }
        if ("scan".equalsIgnoreCase(name)) {
            action = new ScanAction();
        }
        if ("delete".equalsIgnoreCase(name)) {
            action = new DeleteAction();
        }
        action.setTableName(tableName);
        action.setFieldSize(fieldSize);
        action.setKeySpace(keySpace);
        action.setValueSize(valueSize);
        return action;
    }
}
